<template>
  <div class="result_vote">
    <head-top head-title="查看投票结果" goBack="true"></head-top>
    <div class="no-data" style="padding-top:250px; text-align: center; font-size:20px" v-if="code === 400">
      {{message}}
    </div>
    <!--满意度填表类型-->
    <div class="satisForm" v-if="type === 'sat'">
      <div class="satisForm_ul">
        <div class="satisForm_li" v-for="(item,index) in dataList" :key="index"
             @click="govillageDetail(item.article_id)">
          <div class="form_title">
            <div class="title_left">{{item.title}}</div>
            <div class="title_right">查看评分内容</div>
          </div>
          <div class="satis_score">
            <span>满意度评分：</span>{{item.score}}（分）
          </div>
          <div class="satis_remarks">
            <p>备注：</p>
            <textarea readonly="readonly">{{item.content}}</textarea>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<style lang="scss">
  .result_vote {
    width: 100%;
    padding-top: 40px;
    .satisForm {
      width: 100%;
      .satisForm_ul {
        width: 100%;
        .satisForm_li {
          border-bottom: 1px solid #f2f2f2;
          padding: 10px;
          .form_title {
            display: -webkit-box;
            display: -moz-box;
            display: -webkit-flex;
            display: -moz-flex;
            display: -ms-flexbox;
            display: flex;
            align-items: center;
            justify-content: space-between;
            .title_left {
              font-size: 16px;
              width: 70%;
              line-height: 23px;
            }
            .title_right {
              font-size: 15px;
              color: #0178DE;
            }

          }
          .satis_score {
            color: #898989;
            font-size: 15px;
            margin: 10px 0;
            span {
              font-size: 16px;
              color: #595959;
            }
          }
          .satis_remarks {
            p {
              font-size: 15px;
              color: #595959;
            }
            textarea {
              width: 94%;
              padding: 10px;
              margin-top: 10px;
              border: none;
              background: #f2f2f2;
              resize: none;
              outline: none;
              border-radius: 5px;
              color: #545454;
              font-size: 15px;
            }
          }

        }
        .satisForm_li:last-child {
          border-bottom: none;
        }
      }
    }
  }
</style>
<script>
  import headTop from '../header/Header.vue'
  import { getResult } from '../../api/MyIdent'

  export default {
    name: 'MyVote',
    data () {
      return {
        type: '', // 投票类型
        dataList: [],
        message: '',
        code: ''
      }
    },
    components: {
      headTop
    },
    created () {
      this._getResult()
    },
    methods: {
      _getResult () {
        getResult(this.$route.params.id, this.$route.params.type).then(res => {
          this.type = this.$route.params.type
          // console.log(res)
          if (res.code === 200) {
            this.dataList = res.data.data
            // console.log(this.dataList)
          }
          if (res.code === 400) {
            this.code = res.code
            this.message = res.error.message
          }
        })
      },
      // 查看评分内容
      govillageDetail (id) {
        this.$router.push('/home/TakeInResult/' + id)
      }
    }
  }
</script>
